package com.aidong.carnival.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.aidong.carnival.controllers.concerns.Result;
import com.aidong.carnival.controllers.concerns.Success;
import com.aidong.carnival.controllers.concerns.View;
import com.aidong.carnival.service.CarnivalService;
import com.fasterxml.jackson.annotation.JsonView;

@RestController
@RequestMapping("/carnival")
public class HomeController {

	@Autowired
	CarnivalService carnivalService;

	@JsonView(View.Base.class)
	@RequestMapping(value = "/image", method = RequestMethod.GET)
	@ResponseBody
	public Result index(@RequestParam(value = "carnivalId", defaultValue = "1") int carnivalId) {
		return new Success(carnivalService.config());
	}
}
